package day_2022_4_to_7.day48;

import java.util.Scanner;

/**
 * 计算日期到天数转换
 * @author haomin
 * @date 2022/05/10 08:13
 **/
public class Day14_1_DateToDays {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        String[] date = str.split(" ");
        if (isLeapYear(date[0])) {
            int days = getDays(date);
            System.out.println(days);
        } else {
            int days = getDays(date);
            if(Integer.valueOf(date[1]) > 2){
                days -= 1;
            }
            System.out.println(days);
        }
    }

    private static int getDays(String[] date) {
        int month = Integer.valueOf(date[1]);
        int days = 0;
        switch (month){
            case 12:
                days += 30;
            case 11:
                days += 31;
            case 10:
                days += 30;
            case 9:
                days += 31;
            case 8:
                days += 31;
            case 7:
                days += 30;
            case 6:
                days += 31;
            case 5:
                days += 30;
            case 4:
                days += 31;
            case 3:
                days += 29;
            case 2:
                days += 31;
            case 1:
                days += Integer.valueOf(date[2]);
                break;
            default:
                break;
        }
        return days;
    }

    private static boolean isLeapYear(String s) {
        int year = Integer.valueOf(s);
        if((year % 4) == 0 && (year % 100) != 0){
            return true;
        }
        if(year % 400 == 0){
            return true;
        }
        return false;
    }
}